package com.yonyou.cyxdms.basedata.service.dto.basedata;

import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyxdms.framework.bean.dto.base.DMSBaseDTO;
import com.yonyou.cyx.framework.bean.entity.base.BasePO;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;


/**
 * <p>
 * 基础数据
 * </p>
 *
 * @author dengqiang
 * @since 2019-11-21
 */

public class BasedataDTO extends DMSBaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 基础数据ID
     */
    private Long basedataId;
    /**
     * 基础数据标识
     */
    @NotBlank(message = "分类代码不能为空")
    private String basedataType;
    /**
     * 基础数据名称
     */
    @NotBlank(message = "分类名称不能为空")
    private String basedataName;
    /**
     * 数据来源
     */
    private Integer dataSources;
    /**
     * 是否有效
     */
    private Integer isValid;

    public BasedataDTO() {
        super();
    }


    public Long getBasedataId() {
        return basedataId;
    }


    public void setBasedataId(Long basedataId) {
        this.basedataId = basedataId;
    }

    public String getBasedataType() {
        return basedataType;
    }


    public void setBasedataType(String basedataType) {
        this.basedataType = basedataType;
    }


    public String getBasedataName() {
        return basedataName;
    }


    public void setBasedataName(String basedataName) {
        this.basedataName = basedataName;
    }


    public Integer getDataSources() {
        return dataSources;
    }


    public void setDataSources(Integer dataSources) {
        this.dataSources = dataSources;
    }


    public Integer getIsValid() {
        return isValid;
    }


    public void setIsValid(Integer isValid) {
        this.isValid = isValid;
    }



    @Override
    public String toString() {
        return "BasedataDTO{" +
                "basedataId=" + basedataId +
                ", basedataType=" + basedataType +
                ", basedataName=" + basedataName +
                ", dataSources=" + dataSources +
                ", isValid=" + isValid +
                "}";
    }

    /**
     * 将DTO 转换为PO
     * //对某个对象属性进行赋值
     * //BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param poClass dto 需要转换的dto
     * @author dengqiang
     * @since 2018/7/22 0022
     */
    @Override
    public <T extends BasePO> T transDtoToPo(Class<T> poClass) {
        return super.transDtoToPo(poClass);
    }

    /**
     * 将DTO 转换为PO
     * BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param po 需要转换的对象
     * @author dengqiang
     * @since 2018/7/22 0022
     */
    public <T extends BasePO> void transDtoToPo(T po) {
        BeanMapperUtil.copyProperties(this, po, "basedataId");
    }

}
